// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue";
import ViewUI from "view-design";
import VueI18n from 'vue-i18n'
import MetaInfo from 'vue-meta-info'
import "view-design/dist/styles/iview.css";
import "@icon-park/vue/styles/index.css";
// import 'windi.css'
import { Empty,Search } from "@/components"
import store from "./vuex/store"
import messages from './locale/index'
import App from "./App";
import router from "./router";
import api from "./api";
import * as utils from "./common/utils"
const dayjs = require("dayjs")
import LemonIMUI from "lemon-imui"
import "lemon-imui/dist/index.css"
import lemonMessageGoods from '@/components/im/lemonMessageGoods'
import hevueImgPreview from 'hevue-img-preview'

Vue.component('lemonMessageGoods', lemonMessageGoods)

Vue.use(hevueImgPreview, {
  keyboard: true,
  clickMaskCLose: true
})

Vue.use(LemonIMUI)

Vue.use(ViewUI);
Vue.use(MetaInfo)

Vue.config.productionTip = false;
Vue.prototype.$http = api;
Vue.prototype.$utils = utils;
Vue.prototype.$store = store;
Vue.prototype.$dayjs = dayjs
Vue.component('Empty',Empty)
Vue.component('Search',Search)
//多语言

let i18nConfig = {
	locale: 'zh-Hans',//store.getters.getLocalLang.code,
	messages
}

Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)

router.beforeEach((to, from, next) => {
  ViewUI.LoadingBar.start();
  next();
});

router.afterEach(route => {
  ViewUI.LoadingBar.finish();
});


/* eslint-disable no-new */
const _vue = new Vue({
  i18n,
  router,
  store,
  render: h => h(App),
  mounted () {
   document.dispatchEvent(new Event('render-event'))
  }
}).$mount('#app');

Vue.filter('T',v=>{
  if(!v) return ''
  return _vue.$t(v)
})
